#include <iostream>
#include <stdio.h>
using namespace std;

class AA
{
public:
	AA(int a, int b, int c)
	{
		this->a = a;
		this->b = b;
		this->c = c;
		//4执行打印123  6打印456  11打印123  13打印456
		printf("AA construct,a:%d,b:%d,c:%d \n", a, b, c);
	}                                              
	~AA()
	{
		//17析构拷贝456  18析构拷贝123至此形参析构完  20构造456析构   21构造123析构，至此析构完
		printf("~AA() ..a:%d,b:%d,c:%d \n", a, b, c);
	}
private:
	int a;
	int b;
	int c;
};


class BB
{
public:
	//初始化列表    3组合对象AA1先初始化调用构造函数  5组合对象AA2初始化
	BB():a1(1,2,3),a2(4,5,6)
    {
		printf("BB\n");  //7、执行自己打印BB
	}	
	~BB()
	{
		cout<<"~BB()"<<endl;//16 拷贝构造析构  19构造析构
	}
    BB(const BB &obj):a1(1,2,3),a2(4,5,6)//10先构造AA1 12构造AA2
    {
		printf("BB(const BB &obj)....\n");//14 打印
    }
private:
	AA a1; 
    AA a2;
};

int func1(BB mm)//9、用实参初始化形参mm，调用拷贝构造函数
{
    printf(".......\n");//15   打印  至此类的构造函数执行结束
    return 0;
}
int run()
{
	BB b;//2、调用无参构造函数初始化对象b
	func1(b);//8、执行函数ggg
	return 0;
}

int main()
{	
	run();//1、进入run函数
	return 0;
}
